package com.franzliszt.OrderOnline.adapter;

import android.graphics.Color;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.recyclerview.widget.RecyclerView;


import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.franzliszt.OrderOnline.tool.Goods;
import com.franzliszt.hospitalnumberingsystem.R;


import java.util.List;

public class titleAdapter extends BaseQuickAdapter<Goods.GoodsTitle, BaseViewHolder> {
    public int Position;

    public titleAdapter(int layoutResId, @Nullable List<Goods.GoodsTitle> data) {
        super( layoutResId, data );
    }

    public titleAdapter(@Nullable List<Goods.GoodsTitle> data) {
        super( data );
    }

    public titleAdapter(int layoutResId) {
        super( layoutResId );
    }

    @Override
    protected void convert(BaseViewHolder helper, Goods.GoodsTitle item) {
        helper.setTextColor( R.id.title_name,helper.getLayoutPosition() == Position ? Color.parseColor("#ff0000") : Color.parseColor("#000000") );
        helper.setText( R.id.title_name,item.getTitle() );

    }
    public void setSelection(int Position) {
        this.Position = Position;
        notifyDataSetChanged();
    }
}
